package com.qdlc.p2p.dal.dao;


import com.qdlc.p2p.dal.common.dao.BaseDao;
import com.qdlc.p2p.dal.common.model.jpa.PageDataList;
import com.qdlc.p2p.dal.dto.AdditionalUserMovieTicket;
import com.qdlc.p2p.dal.dto.User;
import com.qdlc.p2p.dal.model.AdditionalUserMovieTicketModel;

/**
 * Created by liaoxiangkai on 2015/11/24.
 */
public interface AdditionalUserMovieTicketDao extends BaseDao<AdditionalUserMovieTicket> {

    PageDataList<AdditionalUserMovieTicket> getUserMovieTicketList(User user, int pageNum, int pageSize, int status);

    PageDataList<AdditionalUserMovieTicketModel> list(AdditionalUserMovieTicketModel model);

    /**
     * 更新状态
     * @param code 用户兑换码
     * @param status 状态
     * @return
     */
    int updateByExchangeCode(long userId, String code, int status);

    /**
     * 通过订单号更新
     * @param orderNo 订单号
     * @param partnerId 合作商id
     * @param exchangeCode 兑换码
     * @return
     */
    int updateByOrderNo(String orderNo, String partnerId, String exchangeCode, long userId);

    /**
     * 根据id更新状态
     */
    int updataById(long id, int status);

    /**
     * 获取相同电影用户所获得的张数
     * @param userId 用户id
     * @param ruleId 规则id
     * @return
     */
    int getUserSameMovieCount(long userId, long ruleId);

}
